{% extends "base.html" %}
{% load static %}
{##https://cx.mem.gov.cn/prod-api/certsearch/code#}
{#https://cx.mem.gov.cn/prod-api/certsearch/certInfo/netQuery?name=何健豪&searchType=1&idcardNum=440105199106135115&idcardTypeCode=01&code=8932&uuid=8cf51320ce5d4b40ab94ff8c09cada20&personTypeCode=03#}

{% block headjs %}

{% endblock %}

{% block content %}

        <div class="row ">
            <div class="col-md-12 ">
                <div class="card">
                    <div class="row" style="margin: 12px">
                      <div class="col">

                        <div class="card" style="width: 18rem;">
                          <div class="card-header bg-gray">
                            学员信息
                          </div>
                          <ul class="list-group list-group-flush">

                            <li class="list-group-item">学员名称：{{tzzy_xueyuan_Detail.kehu.username}}</li>
                            <li class="list-group-item">进班时间：{{tzzy_xueyuan_Detail.xueyuan_jinbantime}}<span class="fa fa-edit ml-2"></span></li>
                              {% if tzzy_xueyuan_Detail.shenfenzheng %}
    <li class="list-group-item">身份证号：{{tzzy_xueyuan_Detail.shenfenzheng}}<span class="fa fa-edit ml-2"></span></li>
    {% else %}
    <li class="list-group-item">身份证号：{{tzzy_xueyuan_kehuziliao_info.hujizhenghao}}<span class="fa fa-edit ml-2"></span></li>
                              {% endif %}
                              <li class="list-group-item">文化程度：{{tzzy_xueyuan_Detail.get_wenhuachengdu_display}}<span class="fa fa-edit ml-2"></span></li>
                                {% if tzzy_xueyuan_Detail.jiguan %}
   <li class="list-group-item">籍贯：{{tzzy_xueyuan_Detail.get_jiguan_display}}<span class="fa fa-edit ml-2"></span></li>
    {% else %}
     <li class="list-group-item">籍贯：{{tzzy_xueyuan_kehuziliao_info.get_hujileixing_display}}<span class="fa fa-edit ml-2"></span></li>
                              {% endif %}
                              <li class="list-group-item">学员拿证时间：{{tzzy_xueyuan_Detail.xueyuan_zhengjian_opentime}}<span class="fa fa-edit ml-2"></span></li>
                              <li class="list-group-item">学员资格证到期时间：{{tzzy_xueyuan_Detail.xueyuan_zhengjian_endtime}}<span class="fa fa-edit ml-2"></span></li>

                          </ul>
                        </div>

                                            </div>
                      <div class="col-9">




                          <div class="row">
  <div class="col-3">
    <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
      <button class="nav-link active" id="v-pills-home-zhengshuimg-tab" data-toggle="pill" data-target="#v-pills-home-zhengshuimg" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">学员证书图片</button>
      <button class="nav-link" id="v-pills-profile-tab" data-toggle="pill" data-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">学员附件</button>
      <button class="nav-link" id="v-pills-messages-tab" data-toggle="pill" data-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">学员资格证说明</button>
      <button class="nav-link" id="v-pills-settings-tab" data-toggle="pill" data-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">备注</button>
    </div>
  </div>
  <div class="col-9">
    <div class="tab-content" id="v-pills-tabContent">
      <div class="tab-pane fade show active" id="v-pills-home-zhengshuimg" role="tabpanel" aria-labelledby="v-pills-home-zhengshuimg-tab">

          <button class="btn btn-primary" type="button" id="get-zhengshuimg">获取学员证书图片</button><br />
          <img src="/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA8AKADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl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J2Yp4riv+Etv/8Anjbf98t/jS/8JfqH/PG2/wC+W/8AiqPbRD20TthTxXD/APCYah/zxtf++W/+Kpf+Ey1H/nja/wDfLf8AxVHtoh7aJ3Qp4rg/+Ez1H/nja/8AfDf/ABVL/wAJrqX/ADwtP++G/wDiqPbRD20TvRTxXAf8JtqX/PC0/wC+G/8AiqX/AITjU/8Anhaf98N/8VR7aIe2iegiqur/APID1D/r2k/9BNcV/wAJzqf/ADwtP++G/wDiqjufGeo3VrNbvDahJUZGKq2QCMcfNUyrRsxSqxsz/9k=" style="max-width:500px">

            <div id="zhengshuimg-result"></div>



      </div>
      <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">{{tzzy_xueyuan_Detail.xueyuan_fujian}}  |<a href="/media/{{tzzy_xueyuan_kehuziliao_info.fujian}}">{{tzzy_xueyuan_kehuziliao_info.fujian|safe}}</a></div>
      <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">{{tzzy_xueyuan_Detail.xueyuan_zhengjian_shouming|safe}}</div>
      <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">{{tzzy_xueyuan_Detail.beizhu|safe}}</div>
    </div>
  </div>
</div>



                      </div>
                      </div>
                </div>
            </div>
        </div>




{% endblock %}

{% block footerjs %}
<script>
document.getElementById('get-zhengshuimg').addEventListener('click', async function() {
    try {
        // 第一步：获取验证码
        const response1 = await fetch('https://cx.mem.gov.cn/wxcx/pages/certificateQuery/inquirySpecialCertificate?personTypeCode=03', {
            method: 'GET',

        });

        if (!response1.ok) {
            throw new Error('网络响应失败，无法获取验证码');
        }

        const data1 = await response1.json();
        console.log(data1);

        // 假设返回的JSON对象中的code是我们需要的验证码
        const code = data1.img.split('/').pop(); // 提取图片中的验证码，这里假设验证码是URL的最后一个部分
        const uuid = data1.uuid;

        // 第二步：使用验证码和其他参数获取证书信息
        const response2 = await fetch('https://cx.mem.gov.cn/prod-api/certsearch/certInfo/netQuery', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',

            },
            body: JSON.stringify({
                name: '何健豪',
                searchType: 1,
                idcardNum: '440105199106135115',
                idcardTypeCode: '01',
                code: code,
                uuid: uuid,
                personTypeCode: '03'
            })
        });

        if (!response2.ok) {
            throw new Error('网络响应失败，无法获取证书信息');
        }

        const data2 = await response2.json();
        console.log(data2);

        // 假设data2包含了需要渲染到页面的信息
        const resultDiv = document.getElementById('zhengshuimg-result');
        resultDiv.innerHTML = `<p>消息: ${data2.msg}</p><p>图片URL: ${data2.img}</p>`;

    } catch (error) {
        console.error('请求失败:', error);
        const resultDiv = document.getElementById('zhengshuimg-result');
        resultDiv.innerHTML = `<p>请求失败: ${error.message}</p>`;
    }
});
</script>
{% endblock %}
